package com.kehutong.contact.enums;

import org.coraframework.util.HashID;

/**
 * 住户类型
 * @author liuzhen
 *
 */
public enum ResidentType implements HashID {

    OWNER("1", "业主"),
    FRIEND("2", "家属"),
    LESSEE ("3", "租客")
    ;


    private final String id;
    private final String desc ;

    private ResidentType(String id, String desc) {
        this.id = id;
        this.desc = desc ;
    }

    public static ResidentType get(String desc) {
        ResidentType[] types = values();
        for (ResidentType type : types) {
            if (type.getDesc().equals(desc)) {
                return type;
            }
        }
        return null;
    }
    public static ResidentType getById(String id) {
        ResidentType[] types = values();
        for (ResidentType type : types) {
            if (type.getId().equals(id)) {
                return type;
            }
        }
        return null;
    }
    @Override
    public String getId() {
        return id;
    }

    @Override
    public String getDesc() {
        return desc;
    }
}
